package com.easyctrl.dialog;

import com.easyctrl.iface.OnTransmitText;
import com.easyctrl.ldy.activity.R;
import com.easyctrl.ui.base.BaseDialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;

public class DescribeDialog extends BaseDialog implements OnClickListener{

	private OnTransmitText onTransmitText;
	 
	public void setOnTransmitText(OnTransmitText onTransmitText) {
		this.onTransmitText = onTransmitText;
	} 
	public DescribeDialog(Context context) {
		super(context); 
		setContentView(R.layout.describe);
		getWindow().setGravity(Gravity.BOTTOM);
		
		findViewById(R.id.cancel).setOnClickListener(this);
		findViewById(R.id.confirm).setOnClickListener(this);
	} 

	@Override
	public void onClick(View v) { 
		if(v.getId() == R.id.cancel) { 
			dismiss();
		}else if(v.getId() == R.id.confirm){
			EditText text = (EditText) findViewById(R.id.input);
			if(onTransmitText != null){
				onTransmitText.transmit(text.getText().toString(),OnTransmitText.TRANSMIT_D,0,null);
			}
			dismiss();
		}
	} 
}
